<?php include_once 'common/header.php'; ?>
<!-- admin_main -->
<div class="admin_main">
    <!-- Admin_top end -->
    <?php include_once 'common/site_left.php'; ?>
    <!-- Admin_Left End -->
    <div class="admin_right">
        <div class="admin_right_title">
            <strong>栏目管理</strong> &gt;&gt; 添加文章
        </div>
        <div class="admin_right_info">
            <form action="/ychadmin/article/add/" method="post" id="articleForm" name="articleForm"  enctype="multipart/form-data">
                <input type="hidden" id="nid" name="nid" value="<?php echo $nid; ?>" />
                <div class="admin_right_info_title"><h2>添加文章</h2></div>
                <ul>
                    <li>
                        <font color="red"><?php echo @validation_errors(); ?></font>
                    </li>
                    <li>
                        <div class="admin_right_info_tr admin_right_info_l">标题：</div>
                        <div class="admin_right_info_tr admin_right_info_m">
                            <input type="text" name="title" id="title" size="50"  value="<?php echo @set_value('title'); ?>" />
                        </div>
                        <div class="admin_right_info_tr admin_right_info_r"><div id="titleTip"></div> </div>
                    </li>
                    <li>
                        <div class="admin_right_info_tr admin_right_info_l">所属栏目：</div>
                        <div class="admin_right_info_tr admin_right_info_m">
                            <select id="nid" name="nid">
                                <option value="0">--请选择栏目类型--</option>
                                <?php
                                if ($site_array) {
                                    foreach ($site_array as $key => $v) {
                                        ?>
                                        <option  value="<?php echo $key; ?>">
                                        <?php echo $v; ?>
                                        </option>
                                        <?php
                                    }
                                }
                                ?>
                            </select>


                        </div>
                        <div class="admin_right_info_tr admin_right_info_r"><div id="paret_id" style="color:red;"></div> </div>
                    </li>
                    <li>
                        <div class="admin_right_info_tr admin_right_info_l">作者：</div>
                        <div class="admin_right_info_tr admin_right_info_m">
                            <input type="text" name="author" id="author" size="50" value="<?php echo @set_value('author') ? set_value('author') : COMPANY_NAME; ?>" />
                        </div>
                        <div class="admin_right_info_tr admin_right_info_r"><div id="authorTip"></div></div>
                    </li>
                    <li>
                        <div class="admin_right_info_tr admin_right_info_l">来源：</div>
                        <div class="admin_right_info_tr admin_right_info_m">
                            <input type="text" name="fsource" id="fsource" size="50" value="<?php echo @set_value('fsource') ? set_value('fsource') : COMPANY_NAME; ?>" />
                        </div>
                        <div class="admin_right_info_tr admin_right_info_r"><div id="fsourceTip"></div></div>
                    </li>
                    <li>
                        <div class="admin_right_info_tr admin_right_info_l">缩略图：</div>
                        <div class="admin_right_info_tr admin_right_info_m">
                            <input type="file" name="thumbnail" id="thumbnail" />
                        </div>
                        <div class="admin_right_info_tr admin_right_info_r"></div>
                    </li>

                    <li>
                        <div class="admin_right_info_tr admin_right_info_l">发布时间：</div>
                        <div class="admin_right_info_tr admin_right_info_m">
                            <input type="text" name="ptime" id="ptime" value="<?php echo @set_value('ptime'); ?>" onfocus="WdatePicker()" class="Wdate"/>
                        </div>
                        <div class="admin_right_info_tr admin_right_info_r"><div id="ptimeTip"></div></div>
                    </li>
                    <li>
                        <div class="admin_right_info_tr admin_right_info_l">排序：</div>
                        <div class="admin_right_info_tr admin_right_info_m">
                            <input type="text" name="forder" id="forder" value="<?php echo @set_value('forder') ? set_value('forder') : 0; ?>" />
                        </div>
                        <div class="admin_right_info_tr admin_right_info_r"><div id="forderTip"></div></div>
                    </li>
                    <li>
                        <div class="admin_right_info_tr admin_right_info_l">内容摘要：</div>
                        <div class="admin_right_info_tr admin_right_info_m">
                            <textarea name="summary" id="summary" rows="5" cols="50"></textarea>
                        </div>
                        <div class="admin_right_info_tr admin_right_info_r"><div id="summaryTip"></div></div>
                    </li>
                </ul>
                <div class="admin_right_info_title" style="margin-top:20px;"><h2></h2></div>
                <ul>
                    <li>
                        <div class="admin_right_info_tr admin_right_info_l">内容：</div>
                        <div class="admin_right_info_tr admin_right_info_m">
                            <script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.config.js"></script>
                            <script type="text/javascript" charset="utf-8" src="/static/ueditor/ueditor.all.js"></script>
                            <script type="text/javascript" charset="utf-8">
                                var editor = new baidu.editor.ui.Editor();
                                editor.render('content');  //editor为编辑器容器的id
                            </script>
                            <textarea name="content" id="content" style="width:800px">
<?php echo @set_value('content'); ?>
                            </textarea>
                        </div>
                    </li>
                    <li>
                        <input type="submit" value="提交" />
                    </li>
                </ul>
            </form>
        </div>
    </div>
    <!-- Admin_Right End -->
</div>
<!-- admin_main end -->
<script type="text/javascript">
    $(document).ready(function () {
        $.formValidator.initConfig({formID: "articleForm", debug: false, submitOnce: true,
            onError: function (msg, obj, errorlist) {
                $("#errorlist").empty();
                $.map(errorlist, function (msg) {
                    $("#errorlist").append("<li>" + msg + "</li>")
                });
                alert(msg);
            },
            submitAfterAjaxPrompt: '有数据正在异步验证，请稍等...'
        });
        $("#title").formValidator({autoModify: true, onShow: "", onFocus: "标题在1-50个汉字之间", onCorrect: ""}).inputValidator({min: 1, max: 50, onError: "标题不能为空,请确认"});
        $("#content").formValidator({onShow: "", onFocus: "内容不能为空", onCorrect: ""}).inputValidator({min: 1, onError: "内容不能为空,请确认"});
    });
</script>
<div id="dialog" title="系统提示" style="display:none"><p id="msg" style="text-align:center"></p></div>
</body>
</html>
